package com.ftg.shopping.carshop.controller;

import com.ftg.shopping.carshop.entity.orderdetails;
import com.ftg.shopping.carshop.entity.sp_cartshop;
import com.ftg.shopping.carshop.entity.sp_orderinfo;
import com.ftg.shopping.carshop.service.carshopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api
@RestController
@RequestMapping("/api/carshop")
public class carshopController {

    @Autowired
    carshopService carshopService;

    @ApiOperation("展示购物车信息")
    @GetMapping("/show")
    public List<Map<String,Object>> showcar(String userid){
        return carshopService.showcar(userid);
    }

    @ApiOperation("添加购物车信息")
    @PostMapping("/insert")
    public int insertcar(sp_cartshop spc){
        return carshopService.insertcar(spc);
    }

    @ApiOperation("删除购物车信息")
    @DeleteMapping("/delete")
    public int deletecar(String goodsname,String userid){
        return carshopService.deletecar(goodsname,userid);
    }

    @ApiOperation("添加订单信息")
    @PostMapping("/insertorder")
    public int insertorder(String price,String iphone,String goodsname,String username,String lostmoney){
        return carshopService.insertorder(price,iphone,goodsname,username,lostmoney);
    }


//    @ApiOperation("批量删除购物车信息")
//    @DeleteMapping("/deletes/#{ids}")
//    public int deletecars(List<Integer> ids){
//        return carshopService.deletecars(ids);
//    }

}
